<template>
  <div>
    <a-timeline>
      <a-timeline-item style="width: 500px" v-for="(item, index) in data" :key="index">
        <span class="title">{{ item.DailyRecordTitle }} </span>
        <div style="float: right">
          <span>{{ item.DailyRecordDate.substring(0, 10) }}</span> &nbsp;
          <a @click="del(item)">详情</a>
        </div>
      </a-timeline-item>
    </a-timeline>
    <CommunicationForm ref="communicationForm" />
  </div>
</template>

<script>
import CommunicationForm from '@/views/CustomerManagement/MyCustomer/CommunicationForm.vue' // 沟通记录
import WangEditor from '@/components/WangEditor/WangEditor'
export default {
  components: {
    WangEditor,
    CommunicationForm,
  },
  props: {
    cusId: { require: true, type: String },
  },
  mounted() {
    // 数据获取
    this.getDataList()
  },
  data() {
    return {
      title: '',
      content: '',
      visible: false,
      data: [],
    }
  },
  methods: {
    del(record) {
      this.$refs.communicationForm.openForm(record, '沟通记录查看')
    },
    getDataList() {
      this.$http
        .post('/CustomerManagement/SalesmanDailyRecord/GetDataListByMoreCondition', {
          PageIndex: 1,
          PageRows: 999,
          SortField: 'CreateTime',
          SortType: 'desc',
          Search: [
            {
              Condition: 'CustomerId',
              Keyword: this.cusId,
            },
          ],
        })
        .then((res) => {
          if (res.Success) {
            this.data = res.Data
          }
        })
    },
  },
}
</script>

<style scoped>
.title {
  width: 300px;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>
